<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link type="text/css" rel="stylesheet" href="../css/layui.css" />
		<script type="text/javascript" src="../layui.js"></script>
	</head>
	<body>
		<div id="divModules" class="demo-tree demo-tree-box"> 
		</div> 
		<script>
		layui.use(['tree', 'layer'], function() { 
		  tree = layui.tree; 
		  layer = layui.layer; 
		  $ = layui.$; 
		  active = {    
		    load: function() { //加载当前页     
				   $.post(
					 'http://stuapi.ysdjypt.com/api/GetAllModuleLayUI',
					{"token":'23d66d84-fae1-45d5-bd07-b694662fe579'}, 
					function(res) { 
					 tree.render({ 
						  id: "tv",       
						  elem: "#divModules", //需要做好对应关系       
						  data: res, //服务端返回的数据       
						  edit: ['del','add','update'],//显示三个预订好的小操作图标       
						  click: function(obj) {//单击节点时的事件响应        
							  console.log(obj);        
							  layer.msg("您点击了:"+obj.data.title);       
						  } 
					 }); 
					}, "json"); 
				   } 
				  };   
				     active.load();//调用 active 对象的 load 方法，这是种更推荐的写法。  
			}); 
		</script> 
		 
	</body>
</html>
